豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

More readable error message for invalid queries block and invalid query-filters block#1208

Merged
aeisenberg merged 5 commits intomainfrom
aeisenberg/better-error-message
Aug 23, 2022
Merged

More readable error message for invalid queries block and invalid query-filters block#1208
aeisenberg merged 5 commits intomainfrom
aeisenberg/better-error-message

Conversation

@aeisenberg
Copy link
Copy Markdown
Contributor

Query-filters block:

Throws a more coherent error message when the query-filters block is not an array.

Queries block:

When someone creates an invalid queries entry in the codeql config
file, like this:

queries:
  - foo.ql

The error message is confusing, looking like this:

  Error: Cannot use 'in' operator to search for 'uses' in ql/ql/src
  TypeError: Cannot use 'in' operator to search for 'uses' in ql/ql/src
      at loadConfig (/home/runner/work/_actions/github/codeql-action/71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca/lib/config-utils.js:577:41)

With this change, the error message is more comprehensible:

queries must be an array, with each entry having a 'uses' property

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

When someone creates an invalid `queries` entry in the codeql config
file, like this:

```
queries:
  - foo.ql
```

THe error message is confusing, looking like this:

```
  Error: Cannot use 'in' operator to search for 'uses' in ql/ql/src
  TypeError: Cannot use 'in' operator to search for 'uses' in ql/ql/src
      at loadConfig (/home/runner/work/_actions/github/codeql-action/71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca/lib/config-utils.js:577:41)
```

With this change, the error message is more comprehensible:

`queries must be an array, with each entry having a 'uses' property`
Handle other cases where the config is invalid.
@aeisenberg aeisenberg requested a review from a team as a code owner August 23, 2022 16:28
Copy link
Copy Markdown
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread CHANGELOG.md Outdated
Co-authored-by: Henry Mercer <henrymercer@github.com>
@aeisenberg aeisenberg enabled auto-merge August 23, 2022 17:06
@aeisenberg aeisenberg merged commit 1cd5043 into main Aug 23, 2022
@aeisenberg aeisenberg deleted the aeisenberg/better-error-message branch August 23, 2022 18:29
@github-actions github-actions bot mentioned this pull request Aug 25, 2022
6 tasks
@aeisenberg aeisenberg changed the title More readable error message for invalid queries block and invalid query-filters blocl More readable error message for invalid queries block and invalid query-filters block Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants